package com.by.service.impl;

import com.by.bean.PriceBean;
import com.by.common.bean.PageBean;
import com.by.common.crud.BaseServiceImpl;
import com.by.mapper.PriceMapper;
import com.by.query.PriceQuery;
import com.by.service.PriceService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author:
 * @date: 2025/2/18
 * @version: 1.01
 * @since: jdk11
 */
@Service
public class PriceServiceImpl extends BaseServiceImpl<PriceBean, PriceMapper> implements PriceService {
    @Autowired
    PriceMapper priceMapper;
    @Override
    public PageBean queryByMap(PriceQuery query) {
        //分页查询
        PageHelper.startPage(query.getPage(), query.getPageSize());//后面紧跟查询
        List list = priceMapper.queryByMap(query);
        PageInfo info = new PageInfo(list);
        return new PageBean(query.getPage(), query.getPageSize(), info.getTotal(), list);
    }

    @Override
    public int save(PriceBean entity) {
        return super.save(entity);
    }
}
